package com.hmall.common.client;

import com.hmall.common.pojo.Item;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;

import java.util.List;

/**
 * @author chengjy
 * @date 2023/5/19
 */

@FeignClient("itemservice")
public interface ItemClient {

    @GetMapping("item/lists")
    /**
     * 查询所有
     */
    List<Item> selectList();

    @GetMapping("item/{id}")
    /**
     * 根据id查询商品
     */
    Item getbyId(@PathVariable Long id);

    @PutMapping("item/stock/{itemId}/{num}")
    /**
     * 扣减商品库存
     */
    void updateStock(@PathVariable("itemId") Long itemId,@PathVariable("num") Integer num);
}
